class U_COMMON_API UnicodeString

UnicodeString is a concrete implementation of the abstract class UnicodeText

Public Methods

inline bool_t operator== (const UnicodeString& text) const
Equality operator
inline bool_t operator!= (const UnicodeString& text) const
Inequality operator
inline bool_t operator> (const UnicodeString& text) const
Greater than operator
inline bool_t operator< (const UnicodeString& text) const
Less than operator
inline bool_t operator>= (const UnicodeString& text) const
Greater than or equal operator
inline bool_t operator<= (const UnicodeString& text) const
Less than or equal operator
inline int8_t compare(const UnicodeString& text) const
Compare the characters bitwise in this UnicodeString to the characters in text
inline int8_t compare(UTextOffset start, int32_t length, const UnicodeString& srcText) const
Compare the characters bitwise in the range [start, start + length) with the characters in srcText
inline int8_t compare(UTextOffset start, int32_t length, const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength) const
Compare the characters bitwise in the range [start, start + length) with the characters in srcText in the range [srcStart, srcStart + srcLength)
inline int8_t compare(const UChar *srcChars, int32_t srcLength) const
Compare the characters bitwise in this UnicodeString with the first srcLength characters in srcChars
inline int8_t compare(UTextOffset start, int32_t length, const UChar *srcChars) const
Compare the characters bitwise in the range [start, start + length) with the first length characters in srcChars
inline int8_t compare(UTextOffset start, int32_t length, const UChar *srcChars, UTextOffset srcStart, int32_t srcLength) const
Compare the characters bitwise in the range [start, start + length) with the characters in srcChars in the range [srcStart, srcStart + srcLength)
inline int8_t compareBetween(UTextOffset start, UTextOffset limit, const UnicodeString& srcText, UTextOffset srcStart, UTextOffset srcLimit) const
Compare the characters bitwise in the range [start, limit) with the characters in srcText in the range [srcStart, srcLimit)
inline bool_t startsWith(const UnicodeString& text) const
Determine if this starts with the characters in text
inline bool_t startsWith(const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength) const
Determine if this starts with the characters in srcText in the range [srcStart, srcStart + srcLength)
inline bool_t startsWith(const UChar *srcChars, int32_t srcLength) const
Determine if this starts with the characters in srcChars
inline bool_t startsWith(const UChar *srcChars, UTextOffset srcStart, int32_t srcLength) const
Determine if this ends with the characters in srcChars in the range [srcStart, srcStart + srcLength)
inline bool_t endsWith(const UnicodeString& text) const
Determine if this ends with the characters in text
inline bool_t endsWith(const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength) const
Determine if this ends with the characters in srcText in the range [srcStart, srcStart + srcLength)
inline bool_t endsWith(const UChar *srcChars, int32_t srcLength) const
Determine if this ends with the characters in srcChars
inline bool_t endsWith(const UChar *srcChars, UTextOffset srcStart, int32_t srcLength) const
Determine if this ends with the characters in srcChars in the range [srcStart, srcStart + srcLength)
inline UTextOffset indexOf(const UnicodeString& text) const
Locate in this the first occurrence of the characters in text, using bitwise comparison
inline UTextOffset indexOf(const UnicodeString& text, UTextOffset start) const
Locate in this the first occurrence of the characters in text starting at offset start, using bitwise comparison
inline UTextOffset indexOf(const UnicodeString& text, UTextOffset start, int32_t length) const
Locate in this the first occurrence in the range [start, start + length) of the characters in text, using bitwise comparison
inline UTextOffset indexOf(const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength, UTextOffset start, int32_t length) const
Locate in this the first occurrence in the range [start, start + length) of the characters in srcText in the range [srcStart, srcStart + srcLength), using bitwise comparison
inline UTextOffset indexOf(const UChar *srcChars, int32_t srcLength, UTextOffset start) const
Locate in this the first occurrence of the characters in srcChars starting at offset start, using bitwise comparison
inline UTextOffset indexOf(const UChar *srcChars, int32_t srcLength, UTextOffset start, int32_t length) const
Locate in this the first occurrence in the range [start, start + length) of the characters in srcChars, using bitwise comparison
inline UTextOffset indexOf(const UChar *srcChars, UTextOffset srcStart, int32_t srcLength, UTextOffset start, int32_t length) const
Locate in this the first occurrence in the range [start, start + length) of the characters in srcChars in the range [srcStart, srcStart + srcLength), using bitwise comparison
inline UTextOffset indexOf(UChar c) const
Locate in this the first occurrence of the character c, using bitwise comparison
inline UTextOffset indexOf(UChar c, UTextOffset start) const
Locate in this the first occurrence of the character c starting at offset start, using bitwise comparison
inline UTextOffset indexOf(UChar c, UTextOffset start, int32_t length) const
Locate in this the first occurrence of the character c in the range [start, start + length), using bitwise comparison
inline UTextOffset lastIndexOf(const UnicodeString& text) const
Locate in this the last occurrence of the characters in text, using bitwise comparison
inline UTextOffset lastIndexOf(const UnicodeString& text, UTextOffset start) const
Locate in this the last occurrence of the characters in text starting at offset start, using bitwise comparison
inline UTextOffset lastIndexOf(const UnicodeString& text, UTextOffset start, int32_t length) const
Locate in this the last occurrence in the range [start, start + length) of the characters in text, using bitwise comparison
inline UTextOffset lastIndexOf(const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength, UTextOffset start, int32_t length) const
Locate in this the last occurrence in the range [start, start + length) of the characters in srcText in the range [srcStart, srcStart + srcLength), using bitwise comparison
inline UTextOffset lastIndexOf(const UChar *srcChars, int32_t srcLength, UTextOffset start) const
Locate in this the last occurrence of the characters in srcChars starting at offset start, using bitwise comparison
inline UTextOffset lastIndexOf(const UChar *srcChars, int32_t srcLength, UTextOffset start, int32_t length) const
Locate in this the last occurrence in the range [start, start + length) of the characters in srcChars, using bitwise comparison
inline UTextOffset lastIndexOf(const UChar *srcChars, UTextOffset srcStart, int32_t srcLength, UTextOffset start, int32_t length) const
Locate in this the last occurrence in the range [start, start + length) of the characters in srcChars in the range [srcStart, srcStart + srcLength), using bitwise comparison
inline UTextOffset lastIndexOf(UChar c) const
Locate in this the last occurrence of the character c, using bitwise comparison
inline UTextOffset lastIndexOf(UChar c, UTextOffset start) const
Locate in this the last occurrence of the character c starting at offset start, using bitwise comparison
inline UTextOffset lastIndexOf(UChar c, UTextOffset start, int32_t length) const
Locate in this the last occurrence of the character c in the range [start, start + length), using bitwise comparison
inline UChar charAt(UTextOffset offset) const
Return the character at offset offset
inline UChar operator [] (UTextOffset offset) const
Return the character at offset offset
inline void extract(UTextOffset start, int32_t length, UChar *dst, UTextOffset dstStart = 0) const
Copy the characters in the range [start, start + length) into the array dst, beginning at dstStart
inline void extract(UTextOffset start, int32_t length, UnicodeString& target) const
Copy the characters in the range [start, start + length) into the UnicodeString target
inline void extractBetween(UTextOffset start, UTextOffset limit, UChar *dst, UTextOffset dstStart = 0) const
Copy the characters in the range [start, limit) into the array dst, beginning at dstStart
inline void extractBetween(UTextOffset start, UTextOffset limit, UnicodeString& target) const
Copy the characters in the range [start, limit) into the UnicodeString target
int32_t extract(UTextOffset start, int32_t length, char *dst, const char *codepage = 0) const
Copy the characters in the range [start, start + length) into an array of characters in a specified codepage
inline int32_t length(void) const
Return the length of the UnicodeString object
inline bool_t empty(void) const
Determine if this string is empty
inline int32_t hashCode(void) const
Generate a hash code for this object
inline bool_t isBogus(void) const
Determine if this string is still valid
UnicodeString& operator= (const UnicodeString& srcText)
Assignment operator
inline UnicodeString& operator= (UChar ch)
Assignment operator
inline UnicodeString& setTo(const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength)
Set the text in the UnicodeString object to the characters in srcText in the range [srcStart, srcStart + srcLength)
inline UnicodeString& setTo(const UnicodeString& srcText)
Set the text in the UnicodeString object to the characters in srcText
inline UnicodeString& setTo(const UChar *srcChars, UTextOffset srcStart, int32_t srcLength)
Set the characters in the UnicodeString object to the characters in srcChars in the range [srcStart, srcStart + srcLength)
inline UnicodeString& setTo(const UChar *srcChars, int32_t srcLength)
Set the characters in the UnicodeString object to the characters in srcChars
UnicodeString& setTo(UChar srcChar)
Set the characters in the UnicodeString object to the character srcChar
UnicodeString& setCharAt(UTextOffset offset, UChar ch)
Set the character at the specified offset to the specified character
inline UnicodeString& operator+= (UChar ch)
Append operator
inline UnicodeString& operator+= (const UnicodeString& srcText)
Append operator
inline UnicodeString& append(const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength)
Append the characters in srcText in the range [srcStart, srcStart + srcLength) to the UnicodeString object at offset start
inline UnicodeString& append(const UnicodeString& srcText)
Append the characters in srcText to the UnicodeString object at offset start
inline UnicodeString& append(const UChar *srcChars, UTextOffset srcStart, int32_t srcLength)
Append the characters in srcChars in the range [srcStart, srcStart + srcLength) to the UnicodeString object at offset start
inline UnicodeString& append(const UChar *srcChars, int32_t srcLength)
Append the characters in srcChars to the UnicodeString object at offset start
inline UnicodeString& append(UChar srcChar)
Append the character srcChar to the UnicodeString object
inline UnicodeString& insert(UTextOffset start, const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength)
Insert the characters in srcText in the range [srcStart, srcStart + srcLength) into the UnicodeString object at offset start
inline UnicodeString& insert(UTextOffset start, const UnicodeString& srcText)
Insert the characters in srcText into the UnicodeString object at offset start
inline UnicodeString& insert(UTextOffset start, const UChar *srcChars, UTextOffset srcStart, int32_t srcLength)
Insert the characters in srcChars in the range [srcStart, srcStart + srcLength) into the UnicodeString object at offset start
inline UnicodeString& insert(UTextOffset start, const UChar *srcChars, int32_t srcLength)
Insert the characters in srcChars into the UnicodeString object at offset start
inline UnicodeString& insert(UTextOffset start, UChar srcChar)
Insert the character srcChar into the UnicodeString object at offset start
UnicodeString& replace(UTextOffset start, int32_t length, const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength)
Replace the characters in the range [start, start + length) with the characters in srcText in the range [srcStart, srcStart + srcLength)
UnicodeString& replace(UTextOffset start, int32_t length, const UnicodeString& srcText)
Replace the characters in the range [start, start + length) with the characters in srcText
UnicodeString& replace(UTextOffset start, int32_t length, const UChar *srcChars, UTextOffset srcStart, int32_t srcLength)
Replace the characters in the range [start, start + length) with the characters in srcChars in the range [srcStart, srcStart + srcLength)
inline UnicodeString& replace(UTextOffset start, int32_t length, const UChar *srcChars, int32_t srcLength)
Replace the characters in the range [start, start + length) with the characters in srcChars
inline UnicodeString& replace(UTextOffset start, int32_t length, UChar srcChar)
Replace the characters in the range [start, start + length) with the character srcChar
inline UnicodeString& replaceBetween(UTextOffset start, UTextOffset limit, const UnicodeString& srcText)
Replace the characters in the range [start, limit) with the characters in srcText
inline UnicodeString& replaceBetween(UTextOffset start, UTextOffset limit, const UnicodeString& srcText, UTextOffset srcStart, UTextOffset srcLimit)
Replace the characters in the range [start, limit) with the characters in srcText in the range [srcStart, srcLimit)
inline UnicodeString& findAndReplace(const UnicodeString& oldText, const UnicodeString& newText)
Replace all occurrences of characters in oldText with the characters in newText
inline UnicodeString& findAndReplace(UTextOffset start, int32_t length, const UnicodeString& oldText, const UnicodeString& newText)
Replace all occurrences of characters in oldText with characters in newText in the range [start, start + length)
inline UnicodeString& findAndReplace(UTextOffset start, int32_t length, const UnicodeString& oldText, UTextOffset oldStart, int32_t oldLength, const UnicodeString& newText, UTextOffset newStart, int32_t newLength)
Replace all occurrences of characters in oldText in the range [oldStart, oldStart + oldLength) with the characters in newText in the range [newStart, newStart + newLength) in the range [start, start + length)
inline UnicodeString& remove(void)
Remove all characters from the UnicodeString object
inline UnicodeString& remove(UTextOffset start, int32_t length = LONG_MAX)
Remove the characters in the range [start, start + length) from the UnicodeString object
inline UnicodeString& removeBetween(UTextOffset start, UTextOffset limit = LONG_MAX)
Remove the characters in the range [start, limit) from the UnicodeString object
inline bool_t padLeading(int32_t targetLength, UChar padChar = 0x0020)
Pad the start of this UnicodeString with the character padChar
inline bool_t padTrailing(int32_t targetLength, UChar padChar = 0x0020)
Pad the end of this UnicodeString with the character padChar
inline bool_t truncate(int32_t targetLength)
Truncate this UnicodeString to the targetLength
inline UnicodeString& trim(void)
Trims leading and trailing whitespace from this UnicodeString
inline UnicodeString& reverse(void)
Reverse this UnicodeString in place
inline UnicodeString& reverse(UTextOffset start, int32_t length)
Reverse the range [start, start + length) in this UnicodeString
UnicodeString& toUpper(void)
Convert the characters in this to UPPER CASE following the conventions of the default locale
UnicodeString& toUpper(const Locale& locale)
Convert the characters in this to UPPER CASE following the conventions of a specific locale
UnicodeString& toLower(void)
Convert the characters in this to UPPER CASE following the conventions of the default
UnicodeString& toLower(const Locale& locale)
Convert the characters in this to UPPER CASE following the conventions of a specific locale
UnicodeString()
Construct an empty UnicodeString
UnicodeString(int32_t capacity)
Construct a UnicodeString with capacity to hold capacity UChars
UnicodeString(UChar ch)
Single UChar constructor
UnicodeString(const UChar *text)
UChar* constructor
UnicodeString(const UChar *text, int32_t textLength)
UChar* constructor
UnicodeString(const char *codepageData, const char *codepage = 0)
char* constructor
UnicodeString(const char *codepageData, int32_t dataLength, const char *codepage = 0)
char* constructor
inline UnicodeString(const UnicodeString& that)
Copy constructor
~UnicodeString()
Destructor
int32_t numDisplayCells(UTextOffset start = 0, int32_t length = LONG_MAX, bool_t asian = TRUE) const
Returns the number of display cells occupied by the range [start, length)

Public

Convert the characters in this to UPPER CASE following the conventions of the default locale

Documentation

UnicodeString is a concrete implementation of the abstract class UnicodeText. UnicodeString performs codeset conversion from char* data based on the type of data specified.
inline bool_t operator== (const UnicodeString& text) const
Equality operator. Performs only bitwise comparison.
Returns:
TRUE if text contains the same characters as this one, FALSE otherwise.
Parameters:
text - The UnicodeString to compare to this one.

inline bool_t operator!= (const UnicodeString& text) const
Inequality operator. Performs only bitwise comparison.
Returns:
FALSE if text contains the same characters as this one, TRUE otherwise.
Parameters:
text - The UnicodeString to compare to this one.

inline bool_t operator> (const UnicodeString& text) const
Greater than operator. Performs only bitwise comparison.
Returns:
TRUE if the characters in text are bitwise greater than the characters in this, FALSE otherwise
Parameters:
text - The UnicodeString to compare to this one.

inline bool_t operator< (const UnicodeString& text) const
Less than operator. Performs only bitwise comparison.
Returns:
TRUE if the characters in text are bitwise less than the characters in this, FALSE otherwise
Parameters:
text - The UnicodeString to compare to this one.

inline bool_t operator>= (const UnicodeString& text) const
Greater than or equal operator. Performs only bitwise comparison.
Returns:
TRUE if the characters in text are bitwise greater than or equal to the characters in this, FALSE otherwise
Parameters:
text - The UnicodeString to compare to this one.

inline bool_t operator<= (const UnicodeString& text) const
Less than or equal operator. Performs only bitwise comparison.
Returns:
TRUE if the characters in text are bitwise less than or equal to the characters in this, FALSE otherwise
Parameters:
text - The UnicodeString to compare to this one.

inline int8_t compare(const UnicodeString& text) const
Compare the characters bitwise in this UnicodeString to the characters in text
Returns:
The result of bitwise character comparison: 0 if text contains the same characters as this, -1 if the characters in text are bitwise less than the characters in this, +1 if the characters in text are bitwise greater than the characters in this.
Parameters:
text - The UnicodeString to compare to this one.

inline int8_t compare(UTextOffset start, int32_t length, const UnicodeString& srcText) const
Compare the characters bitwise in the range [start, start + length) with the characters in srcText
Returns:
The result of bitwise character comparison: 0 if text contains the same characters as this, -1 if the characters in text are bitwise less than the characters in this, +1 if the characters in text are bitwise greater than the characters in this.
Parameters:
start - the offset at which the compare operation begins
length - the number of characters of text to compare.
srcText - the text to be compared

inline int8_t compare(UTextOffset start, int32_t length, const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength) const
Compare the characters bitwise in the range [start, start + length) with the characters in srcText in the range [srcStart, srcStart + srcLength).
Returns:
The result of bitwise character comparison: 0 if text contains the same characters as this, -1 if the characters in text are bitwise less than the characters in this, +1 if the characters in text are bitwise greater than the characters in this.
Parameters:
start - the offset at which the compare operation begins
length - the number of characters in this to compare.
srcText - the text to be compared
srcStart - the offset into srcText to start comparison
srcLength - the number of characters in src to compare

inline int8_t compare(const UChar *srcChars, int32_t srcLength) const
Compare the characters bitwise in this UnicodeString with the first srcLength characters in srcChars
Returns:
The result of bitwise character comparison: 0 if text contains the same characters as this, -1 if the characters in text are bitwise less than the characters in this, +1 if the characters in text are bitwise greater than the characters in this.
Parameters:
srcChars - The characters to compare to this UnicodeString.
srcLength - the number of characters in srcChars to compare

inline int8_t compare(UTextOffset start, int32_t length, const UChar *srcChars) const
Compare the characters bitwise in the range [start, start + length) with the first length characters in srcChars
Returns:
The result of bitwise character comparison: 0 if text contains the same characters as this, -1 if the characters in text are bitwise less than the characters in this, +1 if the characters in text are bitwise greater than the characters in this.
Parameters:
start - the offset at which the compare operation begins
length - the number of characters to compare.
srcChars - the characters to be compared

inline int8_t compare(UTextOffset start, int32_t length, const UChar *srcChars, UTextOffset srcStart, int32_t srcLength) const
Compare the characters bitwise in the range [start, start + length) with the characters in srcChars in the range [srcStart, srcStart + srcLength).
Returns:
The result of bitwise character comparison: 0 if text contains the same characters as this, -1 if the characters in text are bitwise less than the characters in this, +1 if the characters in text are bitwise greater than the characters in this.
Parameters:
start - the offset at which the compare operation begins
length - the number of characters in this to compare
srcChars - the characters to be compared
srcStart - the offset into srcChars to start comparison
srcLength - the number of characters in srcChars to compare

inline int8_t compareBetween(UTextOffset start, UTextOffset limit, const UnicodeString& srcText, UTextOffset srcStart, UTextOffset srcLimit) const
Compare the characters bitwise in the range [start, limit) with the characters in srcText in the range [srcStart, srcLimit).
Returns:
The result of bitwise character comparison: 0 if text contains the same characters as this, -1 if the characters in text are bitwise less than the characters in this, +1 if the characters in text are bitwise greater than the characters in this.
Parameters:
start - the offset at which the compare operation begins
limit - the offset immediately following the compare operation
srcText - the text to be compared
srcStart - the offset into srcText to start comparison
srcLimit - the offset into srcText to limit comparison

inline bool_t startsWith(const UnicodeString& text) const
Determine if this starts with the characters in text
Returns:
TRUE if this starts with the characters in text, FALSE otherwise
Parameters:
text - The text to match.

inline bool_t startsWith(const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength) const
Determine if this starts with the characters in srcText in the range [srcStart, srcStart + srcLength).
Returns:
TRUE if this starts with the characters in text, FALSE otherwise
Parameters:
srcText - The text to match.
srcStart - the offset into srcText to start matching
srcLength - the number of characters in srcText to match

inline bool_t startsWith(const UChar *srcChars, int32_t srcLength) const
Determine if this starts with the characters in srcChars
Returns:
TRUE if this starts with the characters in srcChars, FALSE otherwise
Parameters:
srcChars - The characters to match.
srcLength - the number of characters in srcChars

inline bool_t startsWith(const UChar *srcChars, UTextOffset srcStart, int32_t srcLength) const
Determine if this ends with the characters in srcChars in the range [srcStart, srcStart + srcLength).
Returns:
TRUE if this ends with the characters in srcChars, FALSE otherwise
Parameters:
srcChars - The characters to match.
srcStart - the offset into srcText to start matching
srcLength - the number of characters in srcChars to match

inline bool_t endsWith(const UnicodeString& text) const
Determine if this ends with the characters in text
Returns:
TRUE if this ends with the characters in text, FALSE otherwise
Parameters:
text - The text to match.

inline bool_t endsWith(const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength) const
Determine if this ends with the characters in srcText in the range [srcStart, srcStart + srcLength).
Returns:
TRUE if this ends with the characters in text, FALSE otherwise
Parameters:
srcText - The text to match.
srcStart - the offset into srcText to start matching
srcLength - the number of characters in srcText to match

inline bool_t endsWith(const UChar *srcChars, int32_t srcLength) const
Determine if this ends with the characters in srcChars
Returns:
TRUE if this ends with the characters in srcChars, FALSE otherwise
Parameters:
srcChars - The characters to match.
srcLength - the number of characters in srcChars

inline bool_t endsWith(const UChar *srcChars, UTextOffset srcStart, int32_t srcLength) const
Determine if this ends with the characters in srcChars in the range [srcStart, srcStart + srcLength).
Returns:
TRUE if this ends with the characters in srcChars, FALSE otherwise
Parameters:
srcChars - The characters to match.
srcStart - the offset into srcText to start matching
srcLength - the number of characters in srcChars to match

inline UTextOffset indexOf(const UnicodeString& text) const
Locate in this the first occurrence of the characters in text, using bitwise comparison
Returns:
The offset into this of the start of text, or -1 if not found.
Parameters:
text - The text to search for.

inline UTextOffset indexOf(const UnicodeString& text, UTextOffset start) const
Locate in this the first occurrence of the characters in text starting at offset start, using bitwise comparison
Returns:
The offset into this of the start of text, or -1 if not found.
Parameters:
text - The text to search for.
start - The offset at which searching will start.

inline UTextOffset indexOf(const UnicodeString& text, UTextOffset start, int32_t length) const
Locate in this the first occurrence in the range [start, start + length) of the characters in text, using bitwise comparison
Returns:
The offset into this of the start of text, or -1 if not found.
Parameters:
text - The text to search for.
start - The offset at which searching will start.
length - The number of characters to search

inline UTextOffset indexOf(const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength, UTextOffset start, int32_t length) const
Locate in this the first occurrence in the range [start, start + length) of the characters in srcText in the range [srcStart, srcStart + srcLength), using bitwise comparison.
Returns:
The offset into this of the start of text, or -1 if not found.
Parameters:
text - The text to search for.
srcStart - the offset into srcText at which to start matching
srcLength - the number of characters in srcText to match
start - the offset into this at which to start matching
length - the number of characters in this to search

inline UTextOffset indexOf(const UChar *srcChars, int32_t srcLength, UTextOffset start) const
Locate in this the first occurrence of the characters in srcChars starting at offset start, using bitwise comparison.
Returns:
The offset into this of the start of text, or -1 if not found.
Parameters:
srcChars - The text to search for.
srcLength - the number of characters in srcChars to match
start - the offset into this at which to start matching

inline UTextOffset indexOf(const UChar *srcChars, int32_t srcLength, UTextOffset start, int32_t length) const
Locate in this the first occurrence in the range [start, start + length) of the characters in srcChars, using bitwise comparison
Returns:
The offset into this of the start of srcChars, or -1 if not found.
Parameters:
text - The text to search for.
srcLength - the number of characters in srcChars
start - The offset at which searching will start.
length - The number of characters to search

inline UTextOffset indexOf(const UChar *srcChars, UTextOffset srcStart, int32_t srcLength, UTextOffset start, int32_t length) const
Locate in this the first occurrence in the range [start, start + length) of the characters in srcChars in the range [srcStart, srcStart + srcLength), using bitwise comparison.
Returns:
The offset into this of the start of text, or -1 if not found.
Parameters:
srcChars - The text to search for.
srcStart - the offset into srcChars at which to start matching
srcLength - the number of characters in srcChars to match
start - the offset into this at which to start matching
length - the number of characters in this to search

inline UTextOffset indexOf(UChar c) const
Locate in this the first occurrence of the character c, using bitwise comparison
Returns:
The offset into this of c, or -1 if not found.
Parameters:
c - The character to search for.

inline UTextOffset indexOf(UChar c, UTextOffset start) const
Locate in this the first occurrence of the character c starting at offset start, using bitwise comparison
Returns:
The offset into this of c, or -1 if not found.
Parameters:
c - The character to search for.
start - The offset at which searching will start.

inline UTextOffset indexOf(UChar c, UTextOffset start, int32_t length) const
Locate in this the first occurrence of the character c in the range [start, start + length), using bitwise comparison.
Returns:
The offset into this of c, or -1 if not found.
Parameters:
c - The character to search for.
start - the offset into this at which to start matching
length - the number of characters in this to search

inline UTextOffset lastIndexOf(const UnicodeString& text) const
Locate in this the last occurrence of the characters in text, using bitwise comparison
Returns:
The offset into this of the start of text, or -1 if not found.
Parameters:
text - The text to search for.

inline UTextOffset lastIndexOf(const UnicodeString& text, UTextOffset start) const
Locate in this the last occurrence of the characters in text starting at offset start, using bitwise comparison
Returns:
The offset into this of the start of text, or -1 if not found.
Parameters:
text - The text to search for.
start - The offset at which searching will start.

inline UTextOffset lastIndexOf(const UnicodeString& text, UTextOffset start, int32_t length) const
Locate in this the last occurrence in the range [start, start + length) of the characters in text, using bitwise comparison
Returns:
The offset into this of the start of text, or -1 if not found.
Parameters:
text - The text to search for.
start - The offset at which searching will start.
length - The number of characters to search

inline UTextOffset lastIndexOf(const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength, UTextOffset start, int32_t length) const
Locate in this the last occurrence in the range [start, start + length) of the characters in srcText in the range [srcStart, srcStart + srcLength), using bitwise comparison.
Returns:
The offset into this of the start of text, or -1 if not found.
Parameters:
text - The text to search for.
srcStart - the offset into srcText at which to start matching
srcLength - the number of characters in srcText to match
start - the offset into this at which to start matching
length - the number of characters in this to search

inline UTextOffset lastIndexOf(const UChar *srcChars, int32_t srcLength, UTextOffset start) const
Locate in this the last occurrence of the characters in srcChars starting at offset start, using bitwise comparison.
Returns:
The offset into this of the start of text, or -1 if not found.
Parameters:
srcChars - The text to search for.
srcLength - the number of characters in srcChars to match
start - the offset into this at which to start matching

inline UTextOffset lastIndexOf(const UChar *srcChars, int32_t srcLength, UTextOffset start, int32_t length) const
Locate in this the last occurrence in the range [start, start + length) of the characters in srcChars, using bitwise comparison
Returns:
The offset into this of the start of srcChars, or -1 if not found.
Parameters:
text - The text to search for.
srcLength - the number of characters in srcChars
start - The offset at which searching will start.
length - The number of characters to search

inline UTextOffset lastIndexOf(const UChar *srcChars, UTextOffset srcStart, int32_t srcLength, UTextOffset start, int32_t length) const
Locate in this the last occurrence in the range [start, start + length) of the characters in srcChars in the range [srcStart, srcStart + srcLength), using bitwise comparison.
Returns:
The offset into this of the start of text, or -1 if not found.
Parameters:
srcChars - The text to search for.
srcStart - the offset into srcChars at which to start matching
srcLength - the number of characters in srcChars to match
start - the offset into this at which to start matching
length - the number of characters in this to search

inline UTextOffset lastIndexOf(UChar c) const
Locate in this the last occurrence of the character c, using bitwise comparison
Returns:
The offset into this of c, or -1 if not found.
Parameters:
c - The character to search for.

inline UTextOffset lastIndexOf(UChar c, UTextOffset start) const
Locate in this the last occurrence of the character c starting at offset start, using bitwise comparison
Returns:
The offset into this of c, or -1 if not found.
Parameters:
c - The character to search for.
start - The offset at which searching will start.

inline UTextOffset lastIndexOf(UChar c, UTextOffset start, int32_t length) const
Locate in this the last occurrence of the character c in the range [start, start + length), using bitwise comparison.
Returns:
The offset into this of c, or -1 if not found.
Parameters:
c - The character to search for.
start - the offset into this at which to start matching
length - the number of characters in this to search

inline UChar charAt(UTextOffset offset) const
Return the character at offset offset
Returns:
s the character at offset offset
Parameters:
offset - a valid offset into the text

inline UChar operator [] (UTextOffset offset) const
Return the character at offset offset
Returns:
s the character at offset offset
Parameters:
offset - a valid offset into the text

inline void extract(UTextOffset start, int32_t length, UChar *dst, UTextOffset dstStart = 0) const
Copy the characters in the range [start, start + length) into the array dst, beginning at dstStart
Parameters:
start - offset of first character which will be copied into the array
length - the number of characters to extract
dst - array in which to copy characters. The length of dst must be at least (dstStart + length).
dstStart - the offset in dst where the first character will be extracted

inline void extract(UTextOffset start, int32_t length, UnicodeString& target) const
Copy the characters in the range [start, start + length) into the UnicodeString target
Returns:
A reference to target
Parameters:
start - offset of first character which will be copied
length - the number of characters to extract
target - UnicodeString into which to copy characters.

inline void extractBetween(UTextOffset start, UTextOffset limit, UChar *dst, UTextOffset dstStart = 0) const
Copy the characters in the range [start, limit) into the array dst, beginning at dstStart
Parameters:
start - offset of first character which will be copied into the array
limit - offset immediately following the last character to be copied
dst - array in which to copy characters. The length of dst must be at least (dstStart + (limit - start)).
dstStart - the offset in dst where the first character will be extracted

inline void extractBetween(UTextOffset start, UTextOffset limit, UnicodeString& target) const
Copy the characters in the range [start, limit) into the UnicodeString target
Returns:
A reference to target
Parameters:
start - offset of first character which will be copied
limit - offset immediately following the last character to be copied
target - UnicodeString into which to copy characters.

int32_t extract(UTextOffset start, int32_t length, char *dst, const char *codepage = 0) const
Copy the characters in the range [start, start + length) into an array of characters in a specified codepage
Returns:
the number of characters written to dst
Parameters:
start - offset of first character which will be copied
length - the number of characters to extract
target - the target buffer for extraction
codepage - the desired codepage for the characters. 0 has the special meaning of the default codepage

inline int32_t length(void) const
Return the length of the UnicodeString object. The length is the number of characters in the text.
Returns:
s the length of the UnicodeString object

inline bool_t empty(void) const
Determine if this string is empty
Returns:
TRUE if this string contains 0 characters, FALSE otherwise.

inline int32_t hashCode(void) const
Generate a hash code for this object
Returns:
The hash code of this UnicodeString.

inline bool_t isBogus(void) const
Determine if this string is still valid
Returns:
TRUE if the string is valid, FALSE otherwise

UnicodeString& operator= (const UnicodeString& srcText)
Assignment operator. Replace the characters in this UnicodeString with the characters from srcText.
Returns:
a reference to this
Parameters:
srcText - The text containing the characters to replace

inline UnicodeString& operator= (UChar ch)
Assignment operator. Replace the characters in this UnicodeString with the character ch.
Returns:
a reference to this
Parameters:
ch - the character to replace

inline UnicodeString& setTo(const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength)
Set the text in the UnicodeString object to the characters in srcText in the range [srcStart, srcStart + srcLength). srcText is not modified.
Returns:
a reference to this
Parameters:
srcText - the source for the new characters
srcStart - the offset into srcText where new characters will be obtained
srcLength - the number of characters in srcText in the replace string.

inline UnicodeString& setTo(const UnicodeString& srcText)
Set the text in the UnicodeString object to the characters in srcText. srcText is not modified.
Returns:
a reference to this
Parameters:
srcText - the source for the new characters

inline UnicodeString& setTo(const UChar *srcChars, UTextOffset srcStart, int32_t srcLength)
Set the characters in the UnicodeString object to the characters in srcChars in the range [srcStart, srcStart + srcLength). srcChars is not modified.
Returns:
a reference to this
Parameters:
srcChars - the source for the new characters
srcStart - the offset into srcChars where new characters will be obtained
srcLength - the number of characters in srcChars in the replace string

inline UnicodeString& setTo(const UChar *srcChars, int32_t srcLength)
Set the characters in the UnicodeString object to the characters in srcChars. srcChars is not modified.
Returns:
a reference to this
Parameters:
srcChars - the source for the new characters
srcLength - the number of Unicode characters in srcChars.

UnicodeString& setTo(UChar srcChar)
Set the characters in the UnicodeString object to the character srcChar
Returns:
a reference to this
Parameters:
srcChar - the character which becomes the UnicodeString's character content

UnicodeString& setCharAt(UTextOffset offset, UChar ch)
Set the character at the specified offset to the specified character
Returns:
A reference to this
Parameters:
offset - A valid offset into the text of the character to set
ch - The new character

inline UnicodeString& operator+= (UChar ch)
Append operator. Append the character ch to the UnicodeString object.
Returns:
a reference to this
Parameters:
ch - the character to be appended

inline UnicodeString& operator+= (const UnicodeString& srcText)
Append operator. Append the characters in srcText to the UnicodeString object at offset start. srcText is not modified.
Returns:
a reference to this
Parameters:
srcText - the source for the new characters

inline UnicodeString& append(const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength)
Append the characters in srcText in the range [srcStart, srcStart + srcLength) to the UnicodeString object at offset start. srcText is not modified.
Returns:
a reference to this
Parameters:
srcText - the source for the new characters
srcStart - the offset into srcText where new characters will be obtained
srcLength - the number of characters in srcText in the append string

inline UnicodeString& append(const UnicodeString& srcText)
Append the characters in srcText to the UnicodeString object at offset start. srcText is not modified.
Returns:
a reference to this
Parameters:
srcText - the source for the new characters

inline UnicodeString& append(const UChar *srcChars, UTextOffset srcStart, int32_t srcLength)
Append the characters in srcChars in the range [srcStart, srcStart + srcLength) to the UnicodeString object at offset start. srcChars is not modified.
Returns:
a reference to this
Parameters:
srcChars - the source for the new characters
srcStart - the offset into srcChars where new characters will be obtained
srcLength - the number of characters in srcChars in the append string

inline UnicodeString& append(const UChar *srcChars, int32_t srcLength)
Append the characters in srcChars to the UnicodeString object at offset start. srcChars is not modified.
Returns:
a reference to this
Parameters:
srcChars - the source for the new characters
srcLength - the number of Unicode characters in srcChars

inline UnicodeString& append(UChar srcChar)
Append the character srcChar to the UnicodeString object
Returns:
a reference to this
Parameters:
srcChar - the character to append

inline UnicodeString& insert(UTextOffset start, const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength)
Insert the characters in srcText in the range [srcStart, srcStart + srcLength) into the UnicodeString object at offset start. srcText is not modified.
Returns:
a reference to this
Parameters:
start - the offset where the insertion begins
srcText - the source for the new characters
srcStart - the offset into srcText where new characters will be obtained
srcLength - the number of characters in srcText in the insert string

inline UnicodeString& insert(UTextOffset start, const UnicodeString& srcText)
Insert the characters in srcText into the UnicodeString object at offset start. srcText is not modified.
Returns:
a reference to this
Parameters:
start - the offset where the insertion begins
srcText - the source for the new characters

inline UnicodeString& insert(UTextOffset start, const UChar *srcChars, UTextOffset srcStart, int32_t srcLength)
Insert the characters in srcChars in the range [srcStart, srcStart + srcLength) into the UnicodeString object at offset start. srcChars is not modified.
Returns:
a reference to this
Parameters:
start - the offset at which the insertion begins
srcChars - the source for the new characters
srcStart - the offset into srcChars where new characters will be obtained
srcLength - the number of characters in srcChars in the insert string

inline UnicodeString& insert(UTextOffset start, const UChar *srcChars, int32_t srcLength)
Insert the characters in srcChars into the UnicodeString object at offset start. srcChars is not modified.
Returns:
a reference to this
Parameters:
start - the offset where the insertion begins
srcChars - the source for the new characters
srcLength - the number of Unicode characters in srcChars.

inline UnicodeString& insert(UTextOffset start, UChar srcChar)
Insert the character srcChar into the UnicodeString object at offset start
Returns:
a reference to this
Parameters:
start - the offset at which the insertion occurs
srcChar - the character to insert

UnicodeString& replace(UTextOffset start, int32_t length, const UnicodeString& srcText, UTextOffset srcStart, int32_t srcLength)
Replace the characters in the range [start, start + length) with the characters in srcText in the range [srcStart, srcStart + srcLength). srcText is not modified.
Returns:
a reference to this
Parameters:
start - the offset at which the replace operation begins
length - the number of characters to replace. The character at start + length is not modified.
srcText - the source for the new characters
srcStart - the offset into srcText where new characters will be obtained
srcLength - the number of characters in srcText in the replace string

UnicodeString& replace(UTextOffset start, int32_t length, const UnicodeString& srcText)
Replace the characters in the range [start, start + length) with the characters in srcText. srcText is not modified.
Returns:
a reference to this
Parameters:
start - the offset at which the replace operation begins
length - the number of characters to replace. The character at start + length is not modified.
srcText - the source for the new characters

UnicodeString& replace(UTextOffset start, int32_t length, const UChar *srcChars, UTextOffset srcStart, int32_t srcLength)
Replace the characters in the range [start, start + length) with the characters in srcChars in the range [srcStart, srcStart + srcLength). srcChars is not modified.
Returns:
a reference to this
Parameters:
start - the offset at which the replace operation begins
length - the number of characters to replace. The character at start + length is not modified.
srcChars - the source for the new characters
srcStart - the offset into srcChars where new characters will be obtained
srcLength - the number of characters in srcChars in the replace string

inline UnicodeString& replace(UTextOffset start, int32_t length, const UChar *srcChars, int32_t srcLength)
Replace the characters in the range [start, start + length) with the characters in srcChars. srcChars is not modified.
Returns:
a reference to this
Parameters:
start - the offset at which the replace operation begins
length - number of characters to replace. The character at start + length is not modified.
srcChars - the source for the new characters
srcLength - the number of Unicode characters in srcChars

inline UnicodeString& replace(UTextOffset start, int32_t length, UChar srcChar)
Replace the characters in the range [start, start + length) with the character srcChar
Returns:
a reference to this
Parameters:
start - the offset at which the replace operation begins
length - the number of characters to replace. The character at start + length is not modified.
srcChar - the new character

inline UnicodeString& replaceBetween(UTextOffset start, UTextOffset limit, const UnicodeString& srcText)
Replace the characters in the range [start, limit) with the characters in srcText. srcText is not modified.
Returns:
a reference to this
Parameters:
start - the offset at which the replace operation begins
limit - the offset immediately following the replace range
srcText - the source for the new characters

inline UnicodeString& replaceBetween(UTextOffset start, UTextOffset limit, const UnicodeString& srcText, UTextOffset srcStart, UTextOffset srcLimit)
Replace the characters in the range [start, limit) with the characters in srcText in the range [srcStart, srcLimit). srcText is not modified.
Returns:
a reference to this
Parameters:
start - the offset at which the replace operation begins
limit - the offset immediately following the replace range
srcText - the source for the new characters
srcStart - the offset into srcChars where new characters will be obtained
srcLimit - the offset immediately following the range to copy in srcText

inline UnicodeString& findAndReplace(const UnicodeString& oldText, const UnicodeString& newText)
Replace all occurrences of characters in oldText with the characters in newText
Returns:
a reference to this
Parameters:
oldText - the text containing the search text
newText - the text containing the replacement text

inline UnicodeString& findAndReplace(UTextOffset start, int32_t length, const UnicodeString& oldText, const UnicodeString& newText)
Replace all occurrences of characters in oldText with characters in newText in the range [start, start + length)
Returns:
a reference to this
Parameters:
start - the start of the range in which replace will performed
length - the length of the range in which replace will be performed
oldText - the text containing the search text
newText - the text containing the replacement text

inline UnicodeString& findAndReplace(UTextOffset start, int32_t length, const UnicodeString& oldText, UTextOffset oldStart, int32_t oldLength, const UnicodeString& newText, UTextOffset newStart, int32_t newLength)
Replace all occurrences of characters in oldText in the range [oldStart, oldStart + oldLength) with the characters in newText in the range [newStart, newStart + newLength) in the range [start, start + length)
Returns:
a reference to this
Parameters:
start - the start of the range in which replace will performed
length - the length of the range in which replace will be performed
oldText - the text containing the search text
oldStart - the start of the search range in oldText
oldLength - the length of the search range in oldText
newText - the text containing the replacement text
newStart - the start of the replacement range in newText
newLength - the length of the replacement range in newText

inline UnicodeString& remove(void)
Remove all characters from the UnicodeString object
Returns:
a reference to this

inline UnicodeString& remove(UTextOffset start, int32_t length = LONG_MAX)
Remove the characters in the range [start, start + length) from the UnicodeString object
Returns:
a reference to this
Parameters:
start - the offset of the first character to remove
length - the number of characters to remove

inline UnicodeString& removeBetween(UTextOffset start, UTextOffset limit = LONG_MAX)
Remove the characters in the range [start, limit) from the UnicodeString object
Returns:
a reference to this
Parameters:
start - the offset of the first character to remove
limit - the offset immediately following the range to remove

inline bool_t padLeading(int32_t targetLength, UChar padChar = 0x0020)
Pad the start of this UnicodeString with the character padChar. If the length of this UnicodeString is less than targetLength, length() - targetLength copies of padChar will be added to the beginning of this UnicodeString.
Returns:
TRUE if the text was padded, FALSE otherwise.
Parameters:
targetLength - the desired length of the string
padChar - the character to use for padding. Defaults to space (U+0020)

inline bool_t padTrailing(int32_t targetLength, UChar padChar = 0x0020)
Pad the end of this UnicodeString with the character padChar. If the length of this UnicodeString is less than targetLength, length() - targetLength copies of padChar will be added to the end of this UnicodeString.
Returns:
TRUE if the text was padded, FALSE otherwise.
Parameters:
targetLength - the desired length of the string
padChar - the character to use for padding. Defaults to space (U+0020)

inline bool_t truncate(int32_t targetLength)
Truncate this UnicodeString to the targetLength
Returns:
TRUE if the text was truncated, FALSE otherwise
Parameters:
targetLength - the desired length of this UnicodeString.

inline UnicodeString& trim(void)
Trims leading and trailing whitespace from this UnicodeString
Returns:
a reference to this

inline UnicodeString& reverse(void)
Reverse this UnicodeString in place
Returns:
a reference to this

inline UnicodeString& reverse(UTextOffset start, int32_t length)
Reverse the range [start, start + length) in this UnicodeString
Returns:
a reference to this
Parameters:
start - the start of the range to reverse
length - the number of characters to to reverse

UnicodeString& toUpper(void)
Convert the characters in this to UPPER CASE following the conventions of the default locale
Returns:
A reference to this.

UnicodeString& toUpper(const Locale& locale)
Convert the characters in this to UPPER CASE following the conventions of a specific locale
Returns:
A reference to this.
Parameters:
locale - The locale containing the conventions to use.

UnicodeString& toLower(void)
Convert the characters in this to UPPER CASE following the conventions of the default
Returns:
A reference to this.

UnicodeString& toLower(const Locale& locale)
Convert the characters in this to UPPER CASE following the conventions of a specific locale
Returns:
A reference to this.
Parameters:
locale - The locale containing the conventions to use.

UnicodeString()
Construct an empty UnicodeString.

UnicodeString(int32_t capacity)
Construct a UnicodeString with capacity to hold capacity UChars
Parameters:
capacity - the number of UChars this UnicodeString should hold before a resize is necessary

UnicodeString(UChar ch)
Single UChar constructor
Parameters:
ch - the character to place in the UnicodeString

UnicodeString(const UChar *text)
UChar* constructor
Parameters:
text - The characters to place in the UnicodeString. text must be NULL (U+0000) terminated.

UnicodeString(const UChar *text, int32_t textLength)
UChar* constructor
Parameters:
text - The characters to place in the UnicodeString.
textLength - The number of Unicode characters in text to copy.

UnicodeString(const char *codepageData, const char *codepage = 0)
char* constructor
Parameters:
codepageData - an array of bytes, null-terminated
codepage - the encoding of codepageData. The special value 0 for codepage indicates that the text is in the platform's default codepage.

UnicodeString(const char *codepageData, int32_t dataLength, const char *codepage = 0)
char* constructor
Parameters:
codepageData - an array of bytes.
dataLength - The number of bytes in codepageData.
codepage - the encoding of codepageData. The special value 0 for codepage indicates that the text is in the platform's default codepage.

inline UnicodeString(const UnicodeString& that)
Copy constructor
Parameters:
that - The UnicodeString object to copy.

~UnicodeString()
Destructor

int32_t numDisplayCells(UTextOffset start = 0, int32_t length = LONG_MAX, bool_t asian = TRUE) const
Returns the number of display cells occupied by the range [start, length). This function is designed for Asian text and properly takes into account halfwidth and fullwidth variants of various CJK characters and the combining behavior of the Hangul Jamo characters (with some limitations; see documentation for Unicode::getCellWidth()).
In order to avoid dealing with fractions, this function can either be construed to return twice the actual number of display cells or to treat a "cell" as the width of a halfwidth character rather than the width of a fullwidth character.
Returns:
the number of display cells occupied by the specified substring.
Parameters:
start - the start of the range
length - the number of characters to measure
asian - The asian parameter controls whether characters considered NEUTRAL by the Unicode class are treated as halfwidth or fullwidth here. If you set asian to FALSE, neutrals are treated as halfwidth, and this function returns a close approximation of how many Latin display cells the text will take up in a monospaced font.

Convert the characters in this to UPPER CASE following the conventions of the default locale. @retrurn A reference to this.


This class has no child classes.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de